import request from '@/utils/request'

function roleList (param) {
  return request({
    url: '/role/list',
    method: 'get',
    params: param
  })
}

function addRole (data) {
  return request({
    url: '/role/add',
    method: 'post',
    data
  })
}

function roleDetail (id) {
  return request({
    url: 'role/detail',
    method: 'get',
    params: {
      id: id
    }
  })
}

function editRole (data) {
  return request({
    url: '/role/update',
    method: 'post',
    data
  })
}

function delRole (id) {
  return request({
    url: '/role/delete',
    method: 'get',
    params: {
      id: id
    }
  })
}

function roleAuth (id) {
  return request({
    url: '/role/auth',
    method: 'get',
    params: {
      roleId: id
    }
  })
}

function setAuth (data) {
  return request({
    url: '/role/setAuth',
    method: 'post',
    data
  })
}

function getRoleDept (id) {
  return request({
    url: '/role/dept',
    method: 'get',
    params: {
      roleId: id
    }
  });
}

function setDept (data) {
  return request({
    url: '/role/setDept',
    method: 'post',
    data
  });
}

export {
  roleList,
  addRole,
  editRole,
  roleDetail,
  delRole,
  roleAuth,
  setAuth,
  getRoleDept,
  setDept
}
